package com.csproj.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;


/**
 * 系统日志表
 */
@ApiModel(description = "系统日志表")
@Entity
@Table(name = "sys_logs")
@EntityListeners(AuditingEntityListener.class)
public class SysLogs implements Serializable {

    private static final long serialVersionUID = 1L;

    public static  final String OPERATION_TYPE_DELETE = "DELETE";//可用枚举代替
    public static  final String OPERATION_TYPE_GET = "GET";
    public static  final String OPERATION_TYPE_PUT = "PUT";
    public static  final String OPERATION_TYPE_POST= "POST";
    //    @Id
    //    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
    //    @SequenceGenerator(name = "sequenceGenerator")
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(name = "id")
    private String id;

    /**
     * 操作对象ID
     */
    @ApiModelProperty(value = "操作对象ID")
    @Column(name = "rend_id")
    private String rendId;


    /**
     * 角色ID
     */
    @Column(name = "role_info_ids")
    private String roleInfoIds;
    /**
     * 模块类型
     */
    @ApiModelProperty(value = "模块类型")
    @Column(name = "module_type")
    private String moduleType;

    /**
     * 摘要
     */
    @ApiModelProperty(value = "摘要")
    @Column(name = "description")
    private String description;

    /**
     * 操作人用户ID
     */
    @ApiModelProperty(value = "操作人用户ID")
    @Column(name = "user_info_id")
    private String userInfoId;

    /**
     * 操作类型 delete post put  get
     */
    @ApiModelProperty(value = "操作类型 delete post put  get")
    @Column(name = "operation_type")
    private String operationType;

    /**
     * 创建时间
     */
    @CreatedDate
    @ApiModelProperty(value = "创建时间")
    @Column(name = "creation_time")
    private ZonedDateTime creationTime;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Column(name = "remark")
    private String remark;

    /**
     * 创建人
     */
    @CreatedBy
    @ApiModelProperty(value = "创建人")
    @Column(name = "creator_user_id")
    private String creatorUserId;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getRendId() {
        return rendId;
    }

    public SysLogs rendId(String rendId) {
        this.rendId = rendId;
        return this;
    }

    public void setRendId(String rendId) {
        this.rendId = rendId;
    }

    public String getModuleType() {
        return moduleType;
    }

    public SysLogs moduleType(String moduleType) {
        this.moduleType = moduleType;
        return this;
    }

    public String getRoleInfoIds() {
        return roleInfoIds;
    }

    public void setRoleInfoIds(String roleInfoIds) {
        this.roleInfoIds = roleInfoIds;
    }

    public void setModuleType(String moduleType) {
        this.moduleType = moduleType;
    }

    public String getDescription() {
        return description;
    }

    public SysLogs description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUserInfoId() {
        return userInfoId;
    }

    public SysLogs userInfoId(String userInfoId) {
        this.userInfoId = userInfoId;
        return this;
    }

    public void setUserInfoId(String userInfoId) {
        this.userInfoId = userInfoId;
    }

    public String getOperationType() {
        return operationType;
    }

    public SysLogs operationType(String operationType) {
        this.operationType = operationType;
        return this;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

    public ZonedDateTime getCreationTime() {
        return creationTime;
    }

    public SysLogs creationTime(ZonedDateTime creationTime) {
        this.creationTime = creationTime;
        return this;
    }

    public void setCreationTime(ZonedDateTime creationTime) {
        this.creationTime = creationTime;
    }

    public String getRemark() {
        return remark;
    }

    public SysLogs remark(String remark) {
        this.remark = remark;
        return this;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCreatorUserId() {
        return creatorUserId;
    }

    public SysLogs creatorUserId(String creatorUserId) {
        this.creatorUserId = creatorUserId;
        return this;
    }

    public void setCreatorUserId(String creatorUserId) {
        this.creatorUserId = creatorUserId;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SysLogs sysLogs = (SysLogs) o;
        if (sysLogs.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), sysLogs.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "SysLogs{" +
            "id=" + getId() +
            ", rendId='" + getRendId() + "'" +
            ", moduleType='" + getModuleType() + "'" +
            ", description='" + getDescription() + "'" +
            ", userInfoId='" + getUserInfoId() + "'" +
            ", operationType='" + getOperationType() + "'" +
            ", creationTime='" + getCreationTime() + "'" +
            ", remark='" + getRemark() + "'" +
            ", creatorUserId='" + getCreatorUserId() + "'" +
            "}";
    }
}
